home *** CD-ROM | disk | FTP | other *** search
/ Aminet 5 / Aminet 5 - March 1995.iso / Aminet / dev / misc / LEDA_gene.lha / LEDA-3.1c-generic / man / circle.tex < prev    next >
Encoding:
Text File  |  1994-08-05  |  3.5 KB  |  98 lines

  1. \bigskip
  2. \bigskip
  3. {\magonebf 6.1.5  Circles (circle)}
  4.  
  5. {\bf 1. Definition}
  6.  
  7. An instance $C$ of the data type $circle$ is a circle in the two-dimensional 
  8. plane, i.e., the set of points having a certain distance $r$ from a given
  9. point $p$. $r$ is called the radius and $p$ is called the center of $C$.
  10. The circle with center $(0,0)$ and radius $0$ is called the empty circle.
  11.  
  12. \def\name{$circle$}
  13. \def\type{$circle$}
  14.  
  15. {\bf 2. Creation}
  16.  
  17. a) \create C (point\ p,\ double\ r)
  18.  
  19. b) \create C (double\ x,\ double\ y,\ double\ r)
  20.  
  21. c) \create C {}
  22.  
  23.  
  24. introduces a variable $C$ of type $circle$. $C$ is initialized to the circle
  25. with center $p$  and radius $r$ (variant a), to the circle with center $(x,y)$
  26. and radius $r$ (variant b), or to the empty circle (variant c).
  27.  
  28.  
  29. \bigskip
  30. {\bf 3. Operations}
  31.  
  32. \medskip
  33. \+\cleartabs & \hskip 2.4truecm & \hskip 5truecm &\cr
  34. \+\op double         radius {}              
  35.                            {returns the radius of \var.}
  36. \smallskip
  37. \+\op point        center {}              
  38.                            {returns the center of \var.}
  39. \smallskip
  40. \+\op list\<point\> intersection {line\ l}
  41.                            {returns $C \cap l$ as a list of points.}
  42. \smallskip
  43. \+\op list\<point\> intersection {segment\ s}
  44.                            {returns $C \cap s$ as a list of points.}
  45. \smallskip
  46. \+\op list\<point\> intersection {circle\ D}
  47.                            {returns $C \cap D$ as a list of points.}
  48. \smallskip
  49. \+\op segment      left\_tangent {point\ p}
  50.                            {returns the line segment starting in $p$ tangent}
  51. \+\nop                     {to \var\ and left of segment $[p,C.center()]$.}
  52. \smallskip
  53. \+\op segment      right\_tangent {point\ p}
  54.                            {returns the line segment starting in $p$ tangent}
  55. \+\nop                     {to \var\ and right of segment $[p,C.center()]$.}
  56. \smallskip
  57. \+\op double         distance {point\ p}
  58.                            {returns the distance between \var\ and $p$}
  59. \+\nop                     {(negative if $p$ inside \var).}
  60. \smallskip
  61. \+\op double         distance {line\ l}
  62.                            {returns the distance between \var\ and $l$ }
  63. \+\nop                     {(negative if $l$ intersects \var).}
  64. \smallskip
  65. \+\op double         distance {circle\ D}
  66.                            {returns the distance between \var\ and $D$}
  67. \+\nop                     {(negative if $D$ intersects \var).}
  68. \smallskip
  69. \+\op bool          inside {point\ p}
  70.                            {returns true if $P$ lies inside of \var,}
  71. \+\nop                     {false otherwise.}
  72. \smallskip
  73. \+\op bool          outside {point\ p}
  74.                            {returns !\var.inside($p$).}
  75. \smallskip
  76. \+\op circle        translate {vector\ v} 
  77.                            {returns $C+v$, i.e., the circle created by}
  78. \+\nop                     {translating $C$ by vector $v$. \precond }
  79. \+\nop                     {$v$.dim = 2.}
  80. \smallskip
  81. \+\op circle        translate {double\ \alpha,\ double\ d} {}
  82. \+\nop                     {returns the circle created by a translation of}
  83. \+\nop                     {$C$ in direction $\alpha$ by distance $d$.}
  84. \smallskip
  85. \+\op circle        rotate {point\ q,\ double\ \alpha} {}
  86. \+\nop                     {returns the circle created by a rotation of $C$}
  87. \+\nop                     {about point $q$ by angle $\alpha$.}
  88. \smallskip
  89.  
  90. \bigskip
  91. {\bf 4. Operators }
  92. \medskip
  93. \+&$bool$     &$circle$ ==    $circle$    &test for equality\cr
  94. \smallskip
  95. \+&$bool$     &$circle$\ !=\  $circle$    &test for inequality\cr
  96.  
  97. \vfill\eject
  98.